package com.wang.interview.designmode.template;

import java.util.concurrent.*;

/**
 * @author: wang
 * @date: 2021/8/1 19:39
 * @description:
 */
public class Example extends Template {

    @Override
    void work() {
        ThreadPoolExecutor pool = new ThreadPoolExecutor(1, 1, 1, TimeUnit.SECONDS, new LinkedBlockingQueue(), Executors.defaultThreadFactory(), new ThreadPoolExecutor.CallerRunsPolicy());
        pool.execute(()->{
            int a = 0;
            for (int i = 0; i < 100000; i++) {
                a += i;
            }
        });
        pool.shutdown();
    }
}
